package com.glasses.business.adapter;

import android.app.Activity;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.facebook.drawee.view.SimpleDraweeView;
import com.glasses.business.R;
import com.glasses.business.base.MyBaseAdapter;
import com.glasses.business.entity.OrderList;
import com.glasses.business.entity.User;

import java.util.List;

import butterknife.ButterKnife;
import butterknife.InjectView;

/**
 * Author：邓勇军
 * English Name：Deng,The Sky Fucker!
 * Email：dandycoder@126.com
 * Date：2017/3/6
 * Version：1.0
 */

public class OrderGoodsAdapter extends MyBaseAdapter<OrderList.ProductsBean, OrderGoodsAdapter.ViewHolder> {


    public OrderGoodsAdapter(Activity context, List data) {
        super(context, data);
    }

    @Override
    protected ViewHolder getViewHolder() {
        return new ViewHolder(mInflater.inflate(R.layout.item_order_goods, null));
    }

    @Override
    protected void onBindViewHolder_(ViewHolder holder, int position) {
        if (data != null&&data.size()>0) {
            OrderList.ProductsBean productsBean = data.get(position);
            holder.goodImgView.setImageURI(productsBean.getPicture());
            holder.goodMoney.setText("￥"+productsBean.getPrice());
            holder.goodName.setText(productsBean.getName());
            holder.goodDetail.setText(productsBean.getNotes());
        }
    }

    static class ViewHolder extends RecyclerView.ViewHolder {

        @InjectView(R.id.goodImgView)
        SimpleDraweeView goodImgView;
        @InjectView(R.id.goodName)
        TextView goodName;
        @InjectView(R.id.goodColor)
        TextView goodColor;
        @InjectView(R.id.goodDetail)
        TextView goodDetail;
        @InjectView(R.id.goodMoney)
        TextView goodMoney;
        @InjectView(R.id.goodNum)
        TextView goodNum;

        ViewHolder(View view) {
            super(view);
            ButterKnife.inject(this, view);
        }
    }
}
